package com.dhl.rabbitmq.five;

import com.dhl.rabbitmq.utils.RabbitUtils;
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.MessageProperties;
import sun.plugin2.message.Message;

import java.nio.charset.StandardCharsets;

/**
 * @author Administrator
 */
public class EmitLog {

    public static final String EXCHANGE_NAME = "logs";

    public static void main(String[] args) throws Exception {
        // 1.获取信道
        Channel channel = RabbitUtils.getChannel();
        // 2.获取交换
        channel.exchangeDeclare(EXCHANGE_NAME, BuiltinExchangeType.FANOUT);
        int i = 0;
        while(i<5){
            i++;
            // 3.发送信息
            String message = "发送消息滴滴滴";
            channel.basicPublish(EXCHANGE_NAME,"", MessageProperties.PERSISTENT_TEXT_PLAIN,message.getBytes(StandardCharsets.UTF_8));
        }
    }
}
